package com.vcredit.creditcat.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.vcredit.creditcat.model.Cust;
import com.vcredit.creditcat.persistence.base.CustMapper;

/**
 * 
 **/
@Service
public class CustService {
	@Autowired
	private CustMapper mapper;

	public void insert(Cust obj) {
		mapper.insert(obj);
	}

	@CacheEvict(key = "'cust:cust_'+#obj.custId", value = "default")
	public void update(Cust obj) {
		mapper.update(obj);
	}

	public List<Cust> findAll() {
		return mapper.findAll();
	}

	public List<Cust> find(Cust obj) {
		return mapper.find(obj);
	}

	@Cacheable(key = "'cust:cust_'+#id", value = "default")
	public Cust findById(Long id) {
		return mapper.findById(id);
	}

	public Cust findByIdNo(String idNo) {
		return mapper.findByIdNo(idNo);
	}
}